import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/src/common/app_colors.dart';
import 'package:finance_app/src/common/app_spaces.dart';
import 'package:finance_app/src/widgets/common/tag_widget.dart';
import 'package:finance_app/src/widgets/wrapper/normal_form_wrapper.dart';
import 'package:flutter/material.dart';

class EmployeeItem extends StatelessWidget {
  final String title;
  final String content;
  final int badge;
  final String status;
  final bool isLastItem;

  const EmployeeItem(
      {Key key,
      this.title,
      this.content,
      this.badge,
      this.status,
      this.isLastItem = false})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return NormalFormWrapper(
      topPadding: getDp(18),
      bottomPadding: getDp(18),
      leftPadding: getDp(35),
      rightPadding: badge != null ? getDp(27) : getDp(35),
      hasBottomBorder: !isLastItem,
      child: Row(
        children: [
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  title,
                  style: TextStyle(
                    color: aceBlackColor,
                    fontSize: getSp(18),
                    fontWeight: FontWeight.w700,
                    height: 14 / 18,
                  ),
                ),
                AppSpaces.h10,
                Text(
                  content,
                  style: TextStyle(
                    color: aceBlackColor,
                    fontSize: getSp(16),
                    fontWeight: FontWeight.w400,
                    height: 14 / 16,
                  ),
                ),
              ],
            ),
          ),
          if (status != null)
            RedTagWidget(
              content: status,
            )
          else if (badge != null && badge != 0)
            Container(
              decoration: BoxDecoration(
                shape: BoxShape.circle,
                color: aceRedColor,
              ),
              width: getDp(23),
              height: getDp(23),
              alignment: Alignment.center,
              child: Text(
                '$badge',
                style: TextStyle(
                  color: Colors.white,
                  fontSize: getSp(12),
                  fontWeight: FontWeight.w700,
                  height: 13.5 / 12,
                ),
              ),
            )
        ],
      ),
    );
  }
}
